import { Rule } from "./types";

export const Flake8PytestStyleRuleList: Rule[] = [
    {
        code: "PT001",
        name: "pytest-fixture-incorrect-parentheses-style",
        descEn: "Use @pytest.fixture{expected_parens} over @pytest.fixture{actual_parens}",
        descCn: "",
        autoFix: true,
    },
    {
        code: "PT002",
        name: "pytest-fixture-positional-args",
        descEn: "Configuration for fixture {function} specified via positional args, use kwargs",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT003",
        name: "pytest-extraneous-scope-function",
        descEn: "scope='function' is implied in @pytest.fixture()",
        descCn: "",
        autoFix: true,
    },
    {
        code: "PT004",
        name: "pytest-missing-fixture-name-underscore",
        descEn: "Fixture {function} does not return anything, add leading underscore",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT005",
        name: "pytest-incorrect-fixture-name-underscore",
        descEn: "Fixture {function} returns a value, remove leading underscore",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT006",
        name: "pytest-parametrize-names-wrong-type",
        descEn: "Wrong name(s) type in @pytest.mark.parametrize, expected {expected}",
        descCn: "",
        autoFix: true,
    },
    {
        code: "PT007",
        name: "pytest-parametrize-values-wrong-type",
        descEn: "Wrong values type in @pytest.mark.parametrize expected {values} of {row}",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT008",
        name: "pytest-patch-with-lambda",
        descEn: "Use return_value= instead of patching with lambda",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT009",
        name: "pytest-unittest-assertion",
        descEn: "Use a regular assert instead of unittest-style {assertion}",
        descCn: "",
        autoFix: true,
    },
    {
        code: "PT010",
        name: "pytest-raises-without-exception",
        descEn: "set the expected exception in pytest.raises()",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT011",
        name: "pytest-raises-too-broad",
        descEn: "pytest.raises({exception}) is too broad, set the match parameter or use a more specific exception",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT012",
        name: "pytest-raises-with-multiple-statements",
        descEn: "pytest.raises() block should contain a single simple statement",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT013",
        name: "pytest-incorrect-pytest-import",
        descEn: "Found incorrect import of pytest, use simple import pytest instead",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT015",
        name: "pytest-assert-always-false",
        descEn: "Assertion always fails, replace with pytest.fail()",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT016",
        name: "pytest-fail-without-message",
        descEn: "No message passed to pytest.fail()",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT017",
        name: "pytest-assert-in-except",
        descEn: "Found assertion on exception {name} in except block, use pytest.raises() instead",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT018",
        name: "pytest-composite-assertion",
        descEn: "Assertion should be broken down into multiple parts",
        descCn: "",
        autoFix: true,
    },
    {
        code: "PT019",
        name: "pytest-fixture-param-without-value",
        descEn: "Fixture {name} without value is injected as parameter, use @pytest.mark.usefixtures instead	",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT020",
        name: "pytest-deprecated-yield-fixture",
        descEn: "@pytest.yield_fixture is deprecated, use @pytest.fixture",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT021",
        name: "pytest-fixture-finalizer-callback",
        descEn: "Use yield instead of request.addfinalizer",
        descCn: "",
        autoFix: false,
    },
    {
        code: "PT022",
        name: "pytest-useless-yield-fixture",
        descEn: "No teardown in fixture {name}, use return instead of yield",
        descCn: "",
        autoFix: true,
    },
    {
        code: "PT023",
        name: "pytest-incorrect-mark-parentheses-style",
        descEn: "Use @pytest.mark.{mark_name}{expected_parens} over @pytest.mark.{mark_name}{actual_parens}",
        descCn: "",
        autoFix: true,
    },
    {
        code: "PT024",
        name: "pytest-unnecessary-asyncio-mark-on-fixture",
        descEn: "pytest.mark.asyncio is unnecessary for fixtures",
        descCn: "",
        autoFix: true,
    },
    {
        code: "PT025",
        name: "pytest-erroneous-use-fixtures-on-fixture",
        descEn: "pytest.mark.usefixtures has no effect on fixtures",
        descCn: "",
        autoFix: true,
    },
    {
        code: "PT026",
        name: "pytest-use-fixtures-without-parameters",
        descEn: "Useless pytest.mark.usefixtures without parameters",
        descCn: "",
        autoFix: true,
    },
];